gdk: hdr => high depth
authorBenjamin Otte <otte@redhat.com>
Wed, 6 Oct 2021 16:25:30 +0000 (18:25 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 6 Oct 2021 20:50:07 +0000 (22:50 +0200)
The term "hdr" is so overloaded, we shouldn't use them anywhere, except
from maybe describing all of this work in blog posts and other marketing
materials.

So do renames:
* hdr => high_depth
* request_hdr => prefers_high_depth

This more accurately describes what is going on.

21 files changed:
gdk/broadway/gdkcairocontext-broadway.c
gdk/broadway/gdkdrawcontext-broadway.c
gdk/gdk.c
gdk/gdkdebug.h
gdk/gdkdisplay.c
gdk/gdkdisplayprivate.h
gdk/gdkdrawcontext.c
gdk/gdkdrawcontextprivate.h
gdk/gdkglcontext.c
gdk/gdksurface.c
gdk/gdkvulkancontext.c
gdk/macos/gdkmacoscairocontext.c
gdk/macos/gdkmacosglcontext.c
gdk/wayland/gdkcairocontext-wayland.c
gdk/wayland/gdkglcontext-wayland.c
gdk/win32/gdkcairocontext-win32.c
gdk/win32/gdkglcontext-win32-egl.c
gdk/win32/gdkglcontext-win32-wgl.c
gdk/win32/gdkvulkancontext-win32.c
gdk/x11/gdkcairocontext-x11.c
gdk/x11/gdkglcontext-egl.c

index 46fdbaf637904fbc81722b54802de672641475b2..c2924bdf295be837ec076788a14d289b54bb4c6a 100644 (file)
@@ -34,7 +34,7 @@ gdk_broadway_cairo_context_dispose (GObject *object)
 
 static void
 gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
-                                        gboolean        request_hdr,
+                                        gboolean        prefers_high_depth,
                                         cairo_region_t *region)
 {
   GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);
index 660976bff5aabdf016113b0b0982b758d334dd3d..da65aab78abd314184a71772ad7910a088282794 100644 (file)
@@ -34,7 +34,7 @@ gdk_broadway_draw_context_dispose (GObject *object)
 
 static void
 gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
-                                       gboolean        request_hdr,
+                                       gboolean        prefers_high_depth,
                                        cairo_region_t *region)
 {
   GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);
index b050c5916bcaa5e8c9bceae0920a6a7076dd6ca0..123b0413efce8fae1914997b71ad1e7e08677c0b 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -129,7 +129,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
   { "vulkan-disable",  GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
   { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
   { "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
-  { "hdr",             GDK_DEBUG_HDR, "Use HDR rendering if possible", TRUE },
+  { "high-depth",      GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
 };
 
 
index 52460a7a828fb95c6e05372366217bc95d9f5057..acd2259440a09e90abd9c949bb98c96adc88a0f2 100644 (file)
@@ -50,7 +50,7 @@ typedef enum {
   GDK_DEBUG_VULKAN_DISABLE  = 1 << 21,
   GDK_DEBUG_VULKAN_VALIDATE = 1 << 22,
   GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23,
-  GDK_DEBUG_HDR             = 1 << 24,
+  GDK_DEBUG_HIGH_DEPTH      = 1 << 24,
 } GdkDebugFlags;
 
 extern guint _gdk_debug_flags;
index 875cf5c82b22b8db7e9a17871b32ad0ad5fa508f..7d36f2e371383a4d340195e150cb2c4fd130487d 100644 (file)
@@ -93,7 +93,7 @@ struct _GdkDisplayPrivate {
 #ifdef HAVE_EGL
   EGLDisplay egl_display;
   EGLConfig egl_config;
-  EGLConfig egl_config_hdr;
+  EGLConfig egl_config_high_depth;
 #endif
 
   guint rgba : 1;
@@ -1439,11 +1439,11 @@ gdk_display_get_egl_config (GdkDisplay *self)
 }
 
 gpointer
-gdk_display_get_egl_config_hdr (GdkDisplay *self)
+gdk_display_get_egl_config_high_depth (GdkDisplay *self)
 {
   GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
 
-  return priv->egl_config_hdr;
+  return priv->egl_config_high_depth;
 }
 
 static EGLDisplay
@@ -1721,16 +1721,16 @@ gdk_display_init_egl (GdkDisplay  *self,
     epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_pixel_format_float");
 
   if (self->have_egl_no_config_context)
-    priv->egl_config_hdr = gdk_display_create_egl_config (self,
+    priv->egl_config_high_depth = gdk_display_create_egl_config (self,
                                                           GDK_EGL_CONFIG_HDR,
                                                           error);
-  if (priv->egl_config_hdr == NULL)
-    priv->egl_config_hdr = priv->egl_config;
+  if (priv->egl_config_high_depth == NULL)
+    priv->egl_config_high_depth = priv->egl_config;
 
   GDK_DISPLAY_NOTE (self, OPENGL, {
       char *ext = describe_extensions (priv->egl_display);
-      char *sdr_cfg = describe_egl_config (priv->egl_display, priv->egl_config);
-      char *hdr_cfg = describe_egl_config (priv->egl_display, priv->egl_config_hdr);
+      char *std_cfg = describe_egl_config (priv->egl_display, priv->egl_config);
+      char *hd_cfg = describe_egl_config (priv->egl_display, priv->egl_config_high_depth);
       g_message ("EGL API version %d.%d found\n"
                  " - Vendor: %s\n"
                  " - Version: %s\n"
@@ -1738,15 +1738,15 @@ gdk_display_init_egl (GdkDisplay  *self,
                  " - Extensions:\n"
                  "\t%s\n"
                  " - Selected fbconfig: %s\n"
-                 "        HDR fbconfig: %s",
+                 "          high depth: %s",
                  major, minor,
                  eglQueryString (priv->egl_display, EGL_VENDOR),
                  eglQueryString (priv->egl_display, EGL_VERSION),
                  eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
-                 ext, sdr_cfg,
-                 priv->egl_config_hdr == priv->egl_config ? "none" : hdr_cfg);
-      g_free (hdr_cfg);
-      g_free (sdr_cfg);
+                 ext, std_cfg,
+                 priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
+      g_free (hd_cfg);
+      g_free (std_cfg);
       g_free (ext);
   });
 
index 4cb85b2ea4c232f462f10879f877beaa7a13f125..cb80ad3f88a4b110e104ed394b20bbc791ba1fff 100644 (file)
@@ -226,7 +226,8 @@ gboolean            gdk_display_init_egl              (GdkDisplay       *display
                                                        GError          **error);
 gpointer            gdk_display_get_egl_display       (GdkDisplay       *display);
 gpointer            gdk_display_get_egl_config        (GdkDisplay       *display);
-gpointer            gdk_display_get_egl_config_hdr    (GdkDisplay       *display);
+gpointer            gdk_display_get_egl_config_high_depth
+                                                      (GdkDisplay       *display);
 
 void                gdk_display_set_rgba              (GdkDisplay       *display,
                                                        gboolean          rgba);
index b1988c403489bf53a6af80478b6572871564588f..b51e1139ddfa71e679539d5f11e99576352c4730 100644 (file)
@@ -315,28 +315,30 @@ gdk_draw_context_begin_frame (GdkDrawContext       *context,
 }
 
 /*
- * @request_hdr: %TRUE to request high dynamic range.
+ * @prefers_high_depth: %TRUE to request a higher bit depth
  *
- * If HDR is requested, GDK will see about providing a rendering target
- * that supports high dynamic range. Typically this means a target supporting
- * 16bit floating point pixels, but that is not guaranteed.
+ * If high depth is preferred, GDK will see about providing a rendering target
+ * that supports higher bit depth than 8 bits per channel. Typically this means
+ * a target supporting 16bit floating point pixels, but that is not guaranteed.
  *
  * This is only a request and if the GDK backend does not support HDR rendering
  * or does not consider it worthwhile, it may choose to not honor the request.
- * It may also choose to provide HDR even if it was not requested.
+ * It may also choose to provide high depth even if it was not requested.
  * Typically the steps undertaken by a backend are:
- * 1. Check if HDR is supported by this drawing backend.
- * 2. Check if the compositor supports HDR.
- * 3. Check if the compositor prefers SDR. This is usually the case when the attached
- *    monitors do not support HDR content or when the system is resource constrained.
+ * 1. Check if high depth is supported by this drawing backend.
+ * 2. Check if the compositor supports high depth.
+ * 3. Check if the compositor prefers regular bit depth. This is usually the case
+ *    when the attached monitors do not support high depth content or when the
+ *    system is resource constrained.
  * In either of those cases, the context will usually choose to not honor the request.
  *
- * The rendering code must be able to deal with HDR and SDR content, no matter if HDR
- * was requested. The request is only a hint and GDK is free to choose.
+ * The rendering code must be able to deal with content in any bit depth, no matter
+ * the preference. The prefers_high_depth argument is only a hint and GDK is free
+ * to choose.
  */
 void
 gdk_draw_context_begin_frame_full (GdkDrawContext       *context,
-                                   gboolean              request_hdr,
+                                   gboolean              prefers_high_depth,
                                    const cairo_region_t *region)
 {
   GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
@@ -362,13 +364,13 @@ gdk_draw_context_begin_frame_full (GdkDrawContext       *context,
       return;
     }
 
-  if (GDK_DISPLAY_DEBUG_CHECK (priv->display, HDR))
-    request_hdr = TRUE;
+  if (GDK_DISPLAY_DEBUG_CHECK (priv->display, HIGH_DEPTH))
+    prefers_high_depth = TRUE;
 
   priv->frame_region = cairo_region_copy (region);
   priv->surface->paint_context = g_object_ref (context);
 
-  GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, request_hdr, priv->frame_region);
+  GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, prefers_high_depth, priv->frame_region);
 }
 
 #ifdef HAVE_SYSPROF
index 0171876d9d106d39bb6ec4a132780942df2f203c..4674d25f3083be407e8936d709b10aa0dc7bcf85 100644 (file)
@@ -41,7 +41,7 @@ struct _GdkDrawContextClass
   GObjectClass parent_class;
 
   void                  (* begin_frame)                         (GdkDrawContext         *context,
-                                                                 gboolean                request_hdr,
+                                                                 gboolean                prefers_high_depth,
                                                                  cairo_region_t         *update_area);
   void                  (* end_frame)                           (GdkDrawContext         *context,
                                                                  cairo_region_t         *painted);
@@ -51,7 +51,7 @@ struct _GdkDrawContextClass
 void                    gdk_draw_context_surface_resized        (GdkDrawContext         *context);
 
 void                    gdk_draw_context_begin_frame_full       (GdkDrawContext         *context,
-                                                                 gboolean                request_hdr,
+                                                                 gboolean                prefers_high_depth,
                                                                  const cairo_region_t   *region);
 G_END_DECLS
 
index 01b26120ebe59570c6f8b146713eb9291521eaa0..5ea41cdeec7259643fd28efbf456e22690d05f39 100644 (file)
@@ -589,7 +589,7 @@ gdk_gl_context_real_make_current (GdkGLContext *context,
 
 static void
 gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
-                                 gboolean        request_hdr,
+                                 gboolean        prefers_high_depth,
                                  cairo_region_t *region)
 {
   GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
@@ -602,7 +602,7 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
 
 #ifdef HAVE_EGL
   if (priv->egl_context)
-    gdk_surface_ensure_egl_surface (surface, request_hdr);
+    gdk_surface_ensure_egl_surface (surface, prefers_high_depth);
 #endif
 
   damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context);
index 13d779a817b54dc35369cb50281d3901feaffd4d..40d9c21b8f239995a3e8afd864841b4352ca1a32 100644 (file)
@@ -71,7 +71,7 @@ struct _GdkSurfacePrivate
   gpointer egl_native_window;
 #ifdef HAVE_EGL
   EGLSurface egl_surface;
-  gboolean egl_surface_hdr;
+  gboolean egl_surface_high_depth;
 #endif
 
   gpointer widget;
@@ -1109,16 +1109,16 @@ gdk_surface_get_egl_surface (GdkSurface *self)
 
 void
 gdk_surface_ensure_egl_surface (GdkSurface *self,
-                                gboolean    hdr)
+                                gboolean    high_depth)
 {
   GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
   GdkDisplay *display = gdk_surface_get_display (self);
 
   g_return_if_fail (priv->egl_native_window != NULL);
 
-  if (priv->egl_surface_hdr != hdr &&
+  if (priv->egl_surface_high_depth != high_depth &&
       priv->egl_surface != NULL &&
-      gdk_display_get_egl_config_hdr (display) != gdk_display_get_egl_config (display))
+      gdk_display_get_egl_config_high_depth (display) != gdk_display_get_egl_config (display))
     {
       eglDestroySurface (gdk_surface_get_display (self), priv->egl_surface);
       priv->egl_surface = NULL;
@@ -1127,11 +1127,11 @@ gdk_surface_ensure_egl_surface (GdkSurface *self,
   if (priv->egl_surface == NULL)
     {
       priv->egl_surface = eglCreateWindowSurface (gdk_display_get_egl_display (display),
-                                                  hdr ? gdk_display_get_egl_config_hdr (display)
-                                                      : gdk_display_get_egl_config (display),
+                                                  high_depth ? gdk_display_get_egl_config_high_depth (display)
+                                                             : gdk_display_get_egl_config (display),
                                                   (EGLNativeWindowType) priv->egl_native_window,
                                                   NULL);
-      priv->egl_surface_hdr = hdr;
+      priv->egl_surface_high_depth = high_depth;
     }
 #endif
 }
index 2466c317b8613b2e620009a3db57ed19cafeb157..20c1860645376181a710a694f08b387fa1ff6e98 100644 (file)
@@ -425,7 +425,7 @@ device_supports_incremental_present (VkPhysicalDevice device)
 
 static void
 gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
-                                gboolean        request_hdr,
+                                gboolean        prefers_high_depth,
                                 cairo_region_t *region)
 {
   GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
index 7a195ab063026bec9fe20baf787e729e47cf2a49..73ba7cffa08e2c7aab2289cae37e68f62cd7f939 100644 (file)
@@ -82,7 +82,7 @@ _gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
 
 static void
 _gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
-                                      gboolean        request_hdr,
+                                      gboolean        prefers_high_depth,
                                       cairo_region_t *region)
 {
   GdkMacosCairoContext *self = (GdkMacosCairoContext *)draw_context;
index 967648626c6b3f6423ef1cb06c8db4692720de0e..313be91fb93acb87ad3691dada180bece1ceb25f 100644 (file)
@@ -291,7 +291,7 @@ opaque_region_covers_surface (GdkMacosGLContext *self)
 
 static void
 gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
-                                  gboolean        request_hdr,
+                                  gboolean        prefers_high_depth,
                                   cairo_region_t *painted)
 {
   GdkMacosGLContext *self = (GdkMacosGLContext *)context;
@@ -345,7 +345,7 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
       [self->gl_context update];
     }
 
-  GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->begin_frame (context, request_hdr, painted);
+  GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->begin_frame (context, prefers_high_depth, painted);
 
   if (!self->is_attached)
     {
index e06eaa109630330501282f156e80894c5eedd470..e05ea6a7d9947d329df0b91c835f97f305718c76 100644 (file)
@@ -144,7 +144,7 @@ gdk_wayland_cairo_context_create_surface (GdkWaylandCairoContext *self)
 
 static void
 gdk_wayland_cairo_context_begin_frame (GdkDrawContext *draw_context,
-                                       gboolean        request_hdr,
+                                       gboolean        prefers_high_depth,
                                        cairo_region_t *region)
 {
   GdkWaylandCairoContext *self = GDK_WAYLAND_CAIRO_CONTEXT (draw_context);
index 9fc887367a04dff8d008dff816f9fdc0a2adc066..d631816286e0858800087f650df460241d008f6c 100644 (file)
@@ -47,12 +47,12 @@ G_DEFINE_TYPE (GdkWaylandGLContext, gdk_wayland_gl_context, GDK_TYPE_GL_CONTEXT)
 
 static void
 gdk_wayland_gl_context_begin_frame (GdkDrawContext *draw_context,
-                                    gboolean        request_hdr,
+                                    gboolean        prefers_high_depth,
                                     cairo_region_t *region)
 {
   gdk_wayland_surface_ensure_wl_egl_window (gdk_draw_context_get_surface (draw_context));
 
-  GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, request_hdr, region);
+  GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, prefers_high_depth, region);
 
   glDrawBuffers (1, (GLenum[1]) { GL_BACK });
 }
index 65aef46b4849760c061bae510bee7db306f76e12..480baf7802a2fe66cea416a69a58742131d675d4 100644 (file)
@@ -53,7 +53,7 @@ create_cairo_surface_for_surface (GdkSurface *surface,
 
 static void
 gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context,
-                                     gboolean        request_hdr,
+                                     gboolean        prefers_high_depth,
                                      cairo_region_t *region)
 {
   GdkWin32CairoContext *self = GDK_WIN32_CAIRO_CONTEXT (draw_context);
index 8d6bef9e1728c9d042c033f0ce4ad71b51183adf..1507dd822584e4a48d8bd1b783741a6f4cbfd2cc 100644 (file)
@@ -471,12 +471,12 @@ gdk_win32_gl_context_egl_make_current (GdkGLContext *context,
 
 static void
 gdk_win32_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
-                                      gboolean        request_hdr,
+                                      gboolean        prefers_high_depth,
                                       cairo_region_t *update_area)
 {
   gdk_win32_surface_handle_queued_move_resize (draw_context);
 
-  GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, request_hdr, update_area);
+  GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, prefers_high_depth, update_area);
 }
 
 static void
index 9f9bc257a365ec725626735caf5ffcca8506cab0..ea5f377966756d30b186ff9b6891b50e5eb9ad4d 100644 (file)
@@ -118,12 +118,12 @@ gdk_win32_gl_context_wgl_end_frame (GdkDrawContext *draw_context,
 
 static void
 gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
-                                      gboolean        request_hdr,
+                                      gboolean        prefers_high_depth,
                                       cairo_region_t *update_area)
 {
   gdk_win32_surface_handle_queued_move_resize (draw_context);
 
-  GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, request_hdr, update_area);
+  GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, prefers_high_depth, update_area);
 }
 
 static int
index d82cb15d2721bf62e5231e215068c3cdd41c1ad2..894bbfa54890fac7aa868d764f93cf39fde50dbd 100644 (file)
@@ -68,12 +68,12 @@ gdk_win32_vulkan_context_create_surface (GdkVulkanContext *context,
 
 static void
 gdk_win32_vulkan_context_begin_frame (GdkDrawContext *draw_context,
-                                      gboolean        request_hdr,
+                                      gboolean        prefers_high_depth,
                                       cairo_region_t *update_area)
 {
   gdk_win32_surface_handle_queued_move_resize (draw_context);
 
-  GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, request_hdr, update_area);
+  GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, prefers_high_depth, update_area);
 }
 
 static void
index e6accbb6ad910637e355da3fb4ba00fdf3b49e81..e25ec197a7a034d7744b933aad31b2c9c0af831c 100644 (file)
@@ -55,7 +55,7 @@ create_cairo_surface_for_surface (GdkSurface *surface)
 
 static void
 gdk_x11_cairo_context_begin_frame (GdkDrawContext *draw_context,
-                                   gboolean        request_hdr,
+                                   gboolean        prefers_high_depth,
                                    cairo_region_t *region)
 {
   GdkX11CairoContext *self = GDK_X11_CAIRO_CONTEXT (draw_context);
index 39255ac881aaea7caa9aadd34b8d006f8945d6d5..67d730fcfb7fc6ec29868529160f1d2b75e50b56 100644 (file)
@@ -61,10 +61,10 @@ gdk_x11_display_get_egl_display (GdkDisplay *display)
 
 static void
 gdk_x11_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
-                                    gboolean        request_hdr,
+                                    gboolean        prefers_high_depth,
                                     cairo_region_t *region)
 {
-  GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_egl_parent_class)->begin_frame (draw_context, request_hdr, region);
+  GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_egl_parent_class)->begin_frame (draw_context, prefers_high_depth, region);
 
   glDrawBuffers (1, (GLenum[1]) { GL_BACK });
 }